num1 = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
num2 = []
i = 1
#使用for语句
for x in num1:
    if x%2==0:
        num2.append(x)
print(f"从列表：{num1}中取出偶数，组成新列表：{num2}\n")
#使用while语句
while i<=len(num1):
    if i%2==0:
        num2.append(i)
    i+=1
print(f"从列表：{num1}中取出偶数，组成新列表：{num2}\n")
